package com.xunlai.infra.permission.business.service;

import com.xunlai.infra.permission.common.exception.PermissionBusinessException;
import com.xunlai.infra.permission.storage.entity.UserAccount;

import java.util.Date;

/**
 * @author liang
 * @date 2022/11/30 10:32
 */
public interface UserAccountService {

    /**
     * 验证账号密码
     * @param account
     * @param rawPassword
     * @return
     * @throws PermissionBusinessException
     */
    UserAccount verifyAccountAndPassword(String account ,String rawPassword) throws PermissionBusinessException;

    /**
     * 新增账号
     * @param userAccount
     * @return
     * @throws PermissionBusinessException
     */
    UserAccount addAccount(UserAccount userAccount) throws PermissionBusinessException;

    /**
     * 修改账号信息
     * @param userAccount
     * @return
     * @throws PermissionBusinessException
     */
    UserAccount updateAccount(UserAccount userAccount) throws PermissionBusinessException;

    /**
     * 锁定账号
     * @param id 账号ID
     * @return
     * @throws PermissionBusinessException
     */
    int lockAccount(int id) throws PermissionBusinessException;

    /**
     * 检查账号是否存在
     * @param account
     * @return
     * @throws PermissionBusinessException
     */
    boolean checkExist(String account) throws PermissionBusinessException;

    /**
     * 获取用户账号信息
     * @param id
     * @return
     */
    UserAccount getById(int id);

    /**
     * 修改密码
     * @param id
     * @param newRawPassword
     * @return
     * @throws PermissionBusinessException
     */
    boolean modifyPassword(String id,String newRawPassword) throws PermissionBusinessException;

    /**
     *
     * @param id
     * @param loginTime
     * @param loginIp
     * @return
     * @throws PermissionBusinessException
     */
    boolean updateLoginIp(String id , Date loginTime, String loginIp) throws PermissionBusinessException;






}
